package provider;

import anaydis.sort.Sorter;
import anaydis.sort.SorterType;
import anaydis.sort.provider.SorterProvider;
import impl.*;

import java.util.EnumMap;
import java.util.Map;


public class SorterProviderImpl implements SorterProvider {

    private Map<SorterType, Sorter> sortMap;

    public SorterProviderImpl() {
        sortMap = new EnumMap<SorterType, Sorter>(SorterType.class);
        /*sortMap.put(SorterType.BUBBLE, new BubbleSorter());
        sortMap.put(SorterType.INSERTION, new InsertionSorter());
        sortMap.put(SorterType.SELECTION, new SelectionSorter());
        sortMap.put(SorterType.QUICK, new QuickSorter());
        sortMap.put(SorterType.SHELL, new ShellSorter());
        sortMap.put(SorterType.H, new HSorter());
        sortMap.put(SorterType.QUICK_CUT, new QuickSortWithCut());
        sortMap.put(SorterType.QUICK_MED_OF_THREE, new QuickSortMedOfThree());
        sortMap.put(SorterType.QUICK_NON_RECURSIVE, new QuickSortNonRecursive());
        sortMap.put(SorterType.QUICK_THREE_PARTITION, new QuickSortThreeWayPartition());
        */sortMap.put(SorterType.HEAP, new HeapSorter());
        sortMap.put(SorterType.HEAP_TERNARY, new HeapOrderedSorter());
        //sortMap.put(SorterType.MERGE, new MergeSorterTopDown());
        //sortMap.put(SorterType.MERGE_BOTTOM_UP, new MergeSorterBottomUp());
    }

    public Sorter getSorterForType(SorterType sorterType) {
        return sortMap.get(sorterType);
    }

    public Iterable<Sorter> getAllSorters() {
        return sortMap.values();
    }
}